import http from '@/utils/http';
import {baseUrl} from './commonApi'


const paths = {
    getMyCourseNotes: `${baseUrl}/notes/mine`,
    getMyCoursePoints: `${baseUrl}/student/experience`,
    getMyCourseCategory: `${baseUrl}/student/experience`,
    getMyNotesCollect: `${baseUrl}/notes/collect`,
    cancelMyNotesCollect: `${baseUrl}/notes/{id}/cancel-collect`,
    deleteMyNotesCollect: `${baseUrl}/notes/{id}/delete`,
    updateMyNotesCollect: `${baseUrl}/notes/{id}/update`,
    collectNote:`${baseUrl}/notes/{id}/collect`,
};

/**
 * 获取我的笔记，-可以修改，删除，添加的笔记
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function getMyCourseNotes(data, callback) {
    return http.get(paths.getMyCourseNotes, { data }, callback)
}
/**
 * 获取课程积分
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function getMyCoursePoints(data, callback) {
    return http.get(paths.getMyCoursePoints, { data }, callback)
}
/**
 * 
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function getMyCourseCategory(data, callback) {
    return http.get(paths.getMyCourseCategory, { data }, callback)
}
/**
 * 我的收藏笔记
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function getMyNotesCollect(data, callback) {
    return http.get(paths.getMyNotesCollect, { data }, callback)
}


/**
 * 收藏笔记
 */
export function collectNote(id,callback){
 var tPath = paths.collectNote.replace('{id}', id);
    return http.post(tPath, {}, callback)
}

/**
 * 课程笔记取消收藏
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function cancelMyNotesCollect(data, callback) {
    var tPath = paths.cancelMyNotesCollect.replace('{id}', data);
    return http.post(tPath, null, callback)
}
/**
 * 笔记删除
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function deleteMyNotesCollect(id,callback) {
    var tPath = paths.deleteMyNotesCollect.replace('{id}', id);
    return http.post(tPath, null, callback)
}
/**
 * 笔记修改
 * @param {*} data 
 * @param {*} callback 
 * @returns 
 */
export function updateMyNotesCollect(id,data, callback) {
    var tPath = paths.updateMyNotesCollect.replace('{id}', id);
    return http.post(tPath, {data}, callback)
}


